home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 015 / utilprtr.arc / OK84ASET.BAS < prev    next >
Encoding:
BASIC Source File  |  1983-08-26  |  11.1 KB  |  272 lines

  1. 1000 ' OKIDATA 82A PRINTER CONFIGURATION PROGRAM (FOR IBM PC)
  2. 1010 ' (REQUIRES MS BASIC. )  05/26/83  T.E.M. TAILORED FOR PC.
  3. 1020 '
  4. 1030 ' SKIP GILBRECH, (212)685-0551
  5. 1040 ' NOVEMBER 9, 1981
  6. 1050 '
  7. 1060 ' FOR THE OKIDATA 82A
  8. 1070 ' ADAPTED (FREELY) FROM AN MX80 PROGRAM
  9. 1080 ' (MX80FORM.BAS) COPYRIGHT (c)
  10. 1090 ' RODERICK WAYNE HART WA3MEZ
  11. 1100 ' JUNE 21, 1981
  12. 1110 '
  13. 1120 ' THIS PROGRAM IS NOT TO BE USED IN A COMMERCIAL ENVIRONMENT
  14. 1130 ' WITHOUT PROPER AUTHORIZATION.
  15. 1140 '
  16. 1150 '                                        ********** Define variables
  17. 1160 ESC$ = CHR$(27)    'escape command
  18. 1170 BEL$ = CHR$(7)     'bell command
  19. 1180 'CS$  = ESC$+"E"    'clear screen command
  20. 1190 EL$  = ESC$+"l"    'erase entire line command
  21. 1200 CU$  = ESC$+"A"    'cursor up one line command
  22. 1210 DC4$ = CHR$(20)    'loads vertical tab positions
  23. 1220 QU$  = CHR$(63)    'question mark - ends vert. tab loading
  24. 1230 RS$  = CHR$(30)    'designates 10 c.p.i.
  25. 1240 GS$  = CHR$(29)    'designates 16.5 c.p.i.
  26. 1250 US$  = CHR$(31)    'designates wider characters (x2)
  27. 1260 PL$  = ESC$+"F"    'designates page length
  28. 1270 TOF$ = ESC$+"5"    'sets top of form
  29. 1280 LL$  = ESC$+"A"    'designates long line (80 @ 10 c.p.i.)
  30. 1290 SL$  = ESC$+"B"    'designates short line (64 @ 10 c.p.i.)
  31. 1300 '
  32. 1310 '                                   ********** Print sign-on message
  33. 1320 CLS
  34. 1330 PRINT TAB(12) "OKIDATA 82A PRINTER CONFIGURATION PROGRAM"
  35. 1340 PRINT TAB(12) "*****************************************"
  36. 1350 PRINT : PRINT
  37. 1360 PRINT TAB(7) "When the printer is first turned on, it is set to 1/6 inch"
  38. 1370 PRINT TAB(7) "vertical spacing and 10 characters per inch horizontal."
  39. 1380 PRINT TAB(7) "If these values are OK, just leave things alone."
  40. 1390 PRINT TAB(7) "Make sure to turn the printer off and on to initialize it"
  41. 1400 PRINT TAB(7) "if you are setting, or have already set, vertical tabs."
  42. 1410 PRINT
  43. 1420 PRINT TAB(7); : INPUT "Press RETURN when you are ready. ",CR$
  44. 1430 '                                              ********** Print menu
  45. 1440 GOSUB 3610
  46. 1450 PRINT TAB(26) "MAIN MENU"
  47. 1460 PRINT TAB(26) "---------"
  48. 1470 PRINT : PRINT
  49. 1480 PRINT TAB(10) "1.  Set line spacing"
  50. 1490 PRINT TAB(10) "2.  Set vertical tabs"
  51. 1500 PRINT TAB(10) "3.  Set page length"
  52. 1510 PRINT TAB(10) "4.  Set top of form"
  53. 1520 PRINT TAB(10) "5.  Set characters per inch"
  54. 1530 PRINT TAB(10) "6.  Set line length"
  55. 1540 PRINT TAB(10) "7.  Execute printer test"
  56. 1550 PRINT TAB(10) "8.  Return to BASIC command level"
  57. 1560 PRINT TAB(10) "9.  Exit this program."
  58. 1570 GOSUB 3660
  59. 1580 IF S% < 1 OR S% > 9 THEN GOSUB 3500 : GOTO 1440
  60. 1590 ON S% GOTO 1630,1820,2490,2740,2870,3070,3230
  61. 1600 IF S% = 8 THEN CLS: END
  62. 1610 IF S% = 9 THEN CLS: SYSTEM
  63. 1620 '                                            ********** Line spacing
  64. 1630 GOSUB 3610
  65. 1640 PRINT TAB(26) "LINE SPACING"
  66. 1650 PRINT TAB(26) "------------"
  67. 1660 PRINT : PRINT
  68. 1670 PRINT TAB(10) "1.  1/6 inch"
  69. 1680 PRINT TAB(10) "2.  1/8 inch"
  70. 1690 PRINT TAB(10) "3.  Return to main menu"
  71. 1700 GOSUB 3660
  72. 1710 IF S% < 1 OR S% > 3 THEN GOSUB 3500 : GOTO 1630
  73. 1720 ON S% GOTO 1740,1780,1440
  74. 1730 '                                   ********** 1/6 inch line spacing
  75. 1740 LPRINT ESC$+"6" : PRINT
  76. 1750 PRINT TAB(10) "Line spacing set to 1/6 inch"
  77. 1760 GOTO 3460
  78. 1770 '                                   ********** 1/8 inch line spacing
  79. 1780 LPRINT ESC$+"8" : PRINT
  80. 1790 PRINT TAB(10) "Line spacing set to 1/8 inch"
  81. 1800 GOTO 3460
  82. 1810 '                                       ********** Set vertical tabs
  83. 1820 CLS
  84. 1830 PRINT TAB(26) "VERTICAL TABS"
  85. 1840 PRINT TAB(26) "-------------"
  86. 1850 TSP% = 0
  87. 1860 PRINT : PRINT
  88. 1870 PRINT TAB(10) "How many vertical tabs do you wish to set? (27 max.)"
  89. 1880 PRINT TAB(10); : INPUT "(Enter '0' to return to main menu) ",VTAB$
  90. 1890 IF VTAB$ = "0" THEN 1440
  91. 1900 IF LEN(VTAB$) > 2 THEN GOSUB 3500 : GOTO 1820
  92. 1910 VTAB% = VAL(VTAB$)
  93. 1920 IF VTAB% > 27 OR VTAB% < 1 THEN GOSUB 3500 : GOTO 1820
  94. 1930 PRINT
  95. 1940 PRINT TAB(10) "When prompted, enter:"
  96. 1950 PRINT TAB(13) "1) Number of spaces to the first tab, then"
  97. 1960 PRINT TAB(13) "2) The channel number of the tab, then"
  98. 1970 PRINT TAB(13) "3) The number of spaces to the next tab, etc."
  99. 1980 PRINT
  100. 1990 PRINT TAB(10) "Channel numbers can be reused, but cannot have"
  101. 2000 PRINT TAB(10) "a value greater than 12."
  102. 2010 PRINT TAB(10) "Total number of spaces cannot exceed 128."
  103. 2020 PRINT
  104. 2030 PRINT TAB(10) "Note: To access these tabs after they are set, you"
  105. 2040 PRINT TAB(16) "must send CHR$(11) or (^K) plus the channel number"
  106. 2050 PRINT TAB(16) "of the desired tab location to the printer."
  107. 2060 PRINT TAB(16) "Code for channel #10 = ':',#11 = ';',#12 = '<'"
  108. 2070 PRINT
  109. 2080 PRINT TAB(10); : INPUT "Press RETURN when you are ready. ",CR$
  110. 2090 '                                   ********** Begin tab sequence
  111. 2100 GOSUB 3610
  112. 2110 LPRINT DC4$
  113. 2120 FOR X% = 1 TO VTAB%
  114. 2130 PRINT
  115. 2140 PRINT TAB(10); : INPUT "Number of spaces to tab:  ",SP$
  116. 2150 IF SP$ = "0" THEN 2180
  117. 2160 IF LEN(SP$) > 3 OR VAL(SP$) > 128 THEN GOSUB 3560 : GOTO 2140
  118. 2170 IF VAL(SP$) < 1 THEN GOSUB 3560 : GOTO 2140
  119. 2180 SP% = VAL(SP$)
  120. 2190 TSP% = TSP% + SP% : IF TSP% <= 128 THEN 2320
  121. 2200 PRINT : PRINT TAB(10) "Sorry, you entered";SP%;
  122. 2210 IF SP%=1 THEN PRINT "space, and the printer has no more room." : GOTO 2240
  123. 2220 PRINT "spaces, and the printer"
  124. 2230 PRINT TAB(10) "only has room left for";128+SP%-TSP%;"."
  125. 2240 PRINT TAB(10) "You can re-enter the number of spaces or start over."
  126. 2250 TSP% = TSP% - SP% : PRINT
  127. 2260 PRINT TAB(10) "Do you want to start over? <Y/N>"
  128. 2270 YN$ = INKEY$ : IF YN$ = "" THEN 2270
  129. 2280 IF YN$ = "Y" OR YN$ = "y" THEN 2300
  130. 2290 IF YN$ = "N" OR YN$ = "n" THEN PRINT:GOTO 2140:ELSE GOSUB 3560:GOTO 2260
  131. 2300 PRINT : PRINT TAB(10) "OK -- Turn the printer off and on and press RETURN"
  132. 2310 PRINT TAB(10); : INPUT "when you are ready ",CR$ : GOTO 1820
  133. 2320 PRINT
  134. 2330 PRINT TAB(10); : INPUT "Channel number of tab:    ",CH$
  135. 2340 IF LEN(CH$) > 2 THEN GOSUB 3560 : GOTO 2330
  136. 2350 IF VAL(CH$) > 12 OR VAL(CH$) < 1 THEN GOSUB 3560 : GOTO 2330
  137. 2360 IF CH$ = "10" THEN CH$ = ":"
  138. 2370 IF CH$ = "11" THEN CH$ = ";"
  139. 2380 IF CH$ = "12" THEN CH$ = "<"
  140. 2390 '                                     ********** Send tab to printer
  141. 2400 LPRINT SPC(SP%);CH$
  142. 2410 NEXT X%
  143. 2420 LPRINT QU$
  144. 2430 '                                            ********** End sequence
  145. 2440 PRINT
  146. 2450 IF VTAB% = 1 THEN PRINT TAB(9) VTAB%;"vertical tab set." : GOTO 3460
  147. 2460 PRINT TAB(9) VTAB%;"vertical tabs set."
  148. 2470 GOTO 3460
  149. 2480 '                                         ********** Set page length
  150. 2490 GOSUB 3610
  151. 2500 PRINT TAB(27) "PAGE LENGTH"
  152. 2510 PRINT TAB(27) "-----------"
  153. 2520 PRINT : PRINT
  154. 2530 PRINT TAB(10) "1.  Set page length"
  155. 2540 PRINT TAB(10) "2.  Return control to front panel switch"
  156. 2550 PRINT TAB(10) "3.  Return to main menu"
  157. 2560 GOSUB 3660
  158. 2570 IF S% < 1 OR S% > 3 THEN GOSUB 3500 : GOTO 2490
  159. 2580 ON S% GOTO 2590,2700,1440
  160. 2590 PRINT
  161. 2600 PRINT TAB(10); : INPUT "Enter page length desired (0-99 lines): ",L$
  162. 2610 IF L$ = "0" THEN 2640
  163. 2620 IF LEN(L$) > 2 THEN GOSUB 3560 : GOTO 2600
  164. 2630 IF VAL(L$) < 1 THEN GOSUB 3560 : GOTO 2600
  165. 2640 IF VAL(L$) < 10 THEN LPRINT PL$;"0";L$ : GOTO 2670
  166. 2650 LFTL$ = LEFT$(L$,1) : RTL$ = RIGHT$(L$,1)
  167. 2660 LPRINT PL$;LFTL$;RTL$
  168. 2670 PRINT : PRINT TAB(10) "Page length set to ";L$;
  169. 2680 IF L$ = "1" THEN PRINT " line" : GOTO 3460
  170. 2690 PRINT " lines" : GOTO 3460
  171. 2700 PRINT
  172. 2710 LPRINT PL$;"0";"0" : PRINT TAB(10) "Control returned to switch" : GOTO 3460
  173. 2720 '
  174. 2730 '                                         ********** Set top of form
  175. 2740 GOSUB 3610
  176. 2750 PRINT TAB(27) "TOP OF FORM"
  177. 2760 PRINT TAB(27) "-----------"
  178. 2770 PRINT : PRINT
  179. 2780 PRINT TAB(10) "1.  Set top of form (check the paper position)"
  180. 2790 PRINT TAB(10) "2.  Return to main menu"
  181. 2800 GOSUB 3660
  182. 2810 IF S% < 1 OR S% > 2 THEN GOSUB 3500 : GOTO 2740
  183. 2820 ON S% GOTO 2830,1440
  184. 2830 LPRINT TOF$ : PRINT
  185. 2840 PRINT TAB(10) "Top of form set to present position"
  186. 2850 GOTO 3460
  187. 2860 '                                 ********** Set characters per inch
  188. 2870 GOSUB 3610
  189. 2880 PRINT TAB(23) "CHARACTERS PER INCH"
  190. 2890 PRINT TAB(23) "-------------------"
  191. 2900 PRINT : PRINT
  192. 2910 PRINT TAB(10) "1.  5 characters per inch"
  193. 2920 PRINT TAB(10) "2.  8.3 characters per inch"
  194. 2930 PRINT TAB(10) "3.  10 characters per inch"
  195. 2940 PRINT TAB(10) "4.  16.5 characters per inch"
  196. 2950 PRINT TAB(10) "5.  Return to main menu"
  197. 2960 GOSUB 3660
  198. 2970 IF S% < 1 OR S% > 5 THEN GOSUB 3500 : GOTO 2870
  199. 2980 ON S% GOTO 2990,3000,3010,3020,1440
  200. 2990 LPRINT RS$;US$ : GOTO 3030
  201. 3000 LPRINT GS$;US$ : GOTO 3030
  202. 3010 LPRINT RS$ : GOTO 3030
  203. 3020 LPRINT GS$
  204. 3030 A(1) = 5 : A(2) = 8.3 : A(3) = 10 : A(4) = 16.5
  205. 3040 PRINT : PRINT TAB(10) "Printer set to";A(S%);"characters per inch"
  206. 3050 GOTO 3460
  207. 3060 '                                         ********** Line length set
  208. 3070 GOSUB 3610
  209. 3080 PRINT TAB(23) "LINE LENGTH"
  210. 3090 PRINT TAB(23) "-----------"
  211. 3100 PRINT : PRINT
  212. 3110 PRINT TAB(10) "1.  Set long line (80 char. @ 10 c.p.i.)"
  213. 3120 PRINT TAB(10) "2.  Set short line (64 char. @ 10 c.p.i.)"
  214. 3130 PRINT TAB(10) "3.  Return to main menu"
  215. 3140 GOSUB 3660
  216. 3150 IF S% < 1 OR S% > 3 THEN GOSUB 3500 : GOTO 3070
  217. 3160 ON S% GOTO 3170,3180,1440
  218. 3170 LPRINT LL$ : GOTO 3190
  219. 3180 LPRINT SL$
  220. 3190 PRINT : PRINT TAB(10) "Printer set to";
  221. 3200 IF S% = 1 THEN PRINT " long line" ELSE PRINT " short line"
  222. 3210 GOTO 3460
  223. 3220 '                                    ********** Printer test routine
  224. 3230 GOSUB 3610
  225. 3240 PRINT TAB(23) "PRINTER TEST"
  226. 3250 PRINT TAB(23) "------------"
  227. 3260 PRINT : PRINT
  228. 3270 PRINT TAB(10) "1.  Execute printer test"
  229. 3280 PRINT TAB(10) "2.  Return to main menu"
  230. 3290 GOSUB 3660
  231. 3300 IF S% < 1 OR S% > 2 THEN GOSUB 3500 : GOTO 3230
  232. 3310 ON S% GOTO 3320,1440
  233. 3320 PRINT
  234. 3330 PRINT TAB(10) "Do you want a form feed before the test? <Y/N>"
  235. 3340 YN$ = INKEY$ : IF YN$ = "" THEN 3340
  236. 3350 IF YN$ = "Y" OR YN$ = "y" THEN 3380
  237. 3360 IF YN$ = "N" OR YN$ = "n" THEN 3390
  238. 3370 GOSUB 3560 : GOTO 3330
  239. 3380 LPRINT CHR$(12)
  240. 3390 PRINT : PRINT TAB(10) "Type any character to stop printer test"
  241. 3400 FOR X% = 32 TO 126
  242. 3410 IF INKEY$ <> "" THEN 3460
  243. 3420 LPRINT CHR$(X%);
  244. 3430 NEXT X%
  245. 3440 GOTO 3400
  246. 3450 '                           ********* Routine to return to main menu
  247. 3460 PRINT : PRINT
  248. 3470 PRINT TAB(10); : INPUT "Press RETURN for main menu ",CR$
  249. 3480 GOTO 1440
  250. 3490 '                                     ********** Error subroutine # 1
  251. 3500 CLS
  252. 3510 PRINT BEL$ : FOR Z% = 1 TO 6 : PRINT : NEXT
  253. 3520 PRINT TAB(13) "Impossible selection; please try again!"
  254. 3530 FOR Z% = 1 TO 1000 : NEXT
  255. 3540 RETURN
  256. 3550 '                                     ********** Error subroutine # 2
  257. 3560 PRINT CU$;EL$;BEL$;TAB(12) "Impossible selection; please try again!";
  258. 3570 FOR Z% = 1 TO 1000 : NEXT
  259. 3580 PRINT EL$;CU$
  260. 3590 RETURN
  261. 3600 '                                 ********** Clear screen subroutine
  262. 3610 CLS
  263. 3620 PRINT:PRINT
  264. 3630 RETURN
  265. 3640 '                     ********** Wait for character entry subroutine
  266. 3650 '
  267. 3660 PRINT : PRINT
  268. 3670 PRINT TAB(10) "Please enter the number of your choice:"
  269. 3680 S$ = INKEY$ : IF S$ = "" THEN 3680
  270. 3690 S% = VAL(S$) : RETURN
  271. 3700 END
  272.